package org.hard.netty.c3;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * @author: 王林博
 * @date: 2022年08月13日 16:31
 */
public class WriteClient {

    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("localhost",8080));

        int count = 0;
        while (true){
            ByteBuffer buffer = ByteBuffer.allocate(1024*1024);
            final int read = socketChannel.read(buffer);
            count += read;
            System.out.println(count);
//            buffer.clear();
        }
    }
}
